package com.itheima;

import java.util.ArrayList;
import java.util.Arrays;
import java.util.Collections;
import java.util.stream.Stream;

public class a01mystreamDemo {
    public static void main(String[] args) {

        ArrayList<String> list = new ArrayList<>();
        Collections.addAll(list,"张无忌","周芷若","赵敏","张强","张三丰","张无忌");

        //获取stream流
        Stream<String> limit = list.stream().limit(3);
        Stream<String> stream = list.stream().filter(s -> s.startsWith("张"));

//        long count = list.stream().count();
//        System.out.println(count);

        //流里面的数据放到数组中
        Object[] array = list.stream().toArray();
        System.out.println(Arrays.toString(array));

    }
}
